Class HCC.DT.HCC2HL72.NewBloodProdRequst Extends Ens.DataTransformDTL [ DependsOn = (EnsLib.EDI.XML.Document, EnsLib.HL7.Message) ]
{

Parameter IGNOREMISSINGSOURCE = 1;

Parameter REPORTERRORS = 1;

Parameter TREATEMPTYREPEATINGFIELDASNULL = 0;

XData DTL [ XMLNamespace = "http://www.intersystems.com/dtl" ]
{
<transform sourceClass='EnsLib.EDI.XML.Document' targetClass='EnsLib.HL7.Message' sourceDocType='POOR_IN200901UV:POOR_IN200901UV' targetDocType='2.5.1:OMB_O27' create='new' language='objectscript' >
<assign value='source.{id(1).extension}' property='target.{MSH:MessageControlID}' action='set' />
<assign value='source.{creationTime(1).value}' property='target.{MSH:DateTimeOfMessage.Time}' action='set' />
<assign value='"OML"' property='target.{MSH:MessageType.MessageCode}' action='set' />
<assign value='"O21"' property='target.{MSH:MessageType.TriggerEvent}' action='set' />
<assign value='source.{controlActProcess().subject().choice.procedureRequest().text.value}' property='target.{ORCgrp().NTE():Comment()}' action='set' />
<assign value='source.{controlActProcess().subject().choice.procedureRequest().statusCode().code}' property='target.{ORCgrp(1).ORC:OrderStatus}' action='set' />
<assign value='source.{controlActProcess().subject().choice.procedureRequest().effectiveTime.validTimeHigh}' property='target.{ORCgrp(1).ORC:OrderEffectiveDateTime.Time}' action='set' />
<assign value='source.{controlActProcess().subject().choice.procedureRequest().id().item().extension}' property='target.{ORCgrp(1).ORC:PlacerOrderNumber}' action='set' />
<assign value='source.{controlActProcess().subject().choice.procedureRequest().priorityCode.code}' property='target.{ORCgrp().DG1():DiagnosisPriority}' action='set' />
<assign value='source.{controlActProcess().subject().choice.procedureRequest().author.assignedEntity().id.item().extension}' property='target.{ORCgrp(1).ORC:OrderingProvider(1).IDNumber}' action='set' />
<assign value='source.{controlActProcess().subject().choice.procedureRequest().author.signatureText.value}' property='target.{ORCgrp(1).ORC:OrderingProvider(1).GivenName}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath(source.{controlActProcess().subject().choice.procedureRequest(1).author.assignedEntity().choice.assignedPerson.name()})' property='target.{ORCgrp(1).ORC:OrderingProvider(1).FamilyName}' action='set' />
<assign value='source.{controlActProcess().subject().choice.procedureRequest().author.assignedEntity().representedOrganization.id().item().extension}' property='target.{ORCgrp().ORC:OrderingFacilityName().IDNumber}' action='set' />
<assign value='source.{controlActProcess().subject().choice.procedureRequest().author.assignedEntity().representedOrganization.name}' property='target.{ORCgrp().ORC:OrderingFacilityName().OrganizationName}' action='set' />
<assign value='source.{controlActProcess().subject().choice.procedureRequest().verifier().time.value}' property='target.{ORCgrp(1).ORC:VerifiedBy(1).EffectiveDate}' action='set' />
<assign value='source.{controlActProcess().subject().choice.procedureRequest().verifier().assignedEntity().id.item().extension}' property='target.{ORCgrp(1).ORC:VerifiedBy(1).IDNumber}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath(source.{controlActProcess().subject().choice.procedureRequest().verifier().assignedEntity().choice.assignedPerson.name()})' property='target.{ORCgrp(1).ORC:VerifiedBy(1).GivenName}' action='set' />
<assign value='source.{controlActProcess().subject().choice.procedureRequest().author.assignedEntity().representedOrganization.id().item().root}' property='target.{ORCgrp(1).ORC:EnteringOrganization.Identifier}' action='set' />
<assign value='"LAB"' property='target.{ORCgrp().ORC:OrderType}' action='set' />
<assign value='source.{controlActProcess(1).subject(1).choice.procedureRequest(1).componentOf1.encounter(1).id(1).item(1).extension}' property='target.{PIDgrp.PV1grp.PV1:VisitNumber.IDNumber}' action='set' />
<assign value='source.{controlActProcess(1).subject(1).choice.procedureRequest(1).componentOf1.encounter(1).code.code}' property='target.{PIDgrp.PV1grp.PV1:AdmissionType}' action='set' />
<assign value='source.{controlActProcess(1).subject(1).choice.procedureRequest(1).componentOf1.encounter(1).code.code}' property='target.{PIDgrp.PV1grp.PV1:PatientClass}' action='set' />
<assign value='source.{controlActProcess().subject().choice.procedureRequest().componentOf1.encounter().location().serviceDeliveryLocation().location.id.item().extension}' property='target.{PIDgrp.PV1grp.PV1:AssignedPatientLocation.Bed}' action='set' />
<assign value='source.{controlActProcess(1).subject(1).choice.procedureRequest(1).componentOf1.encounter(1).location(1).serviceDeliveryLocation(1).location.asLocatedEntityPartOf(1).location(1).id.item(1).extension}' property='target.{PIDgrp.PV1grp.PV1:AssignedPatientLocation.Room}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath(source.{controlActProcess().subject().choice.procedureRequest().componentOf1.encounter().location().serviceDeliveryLocation().serviceProviderOrganization.name})' property='target.{PIDgrp.PV1grp.PV1:AssignedPatientLocation.Facility}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath(source.{controlActProcess(1).subject(1).choice.procedureRequest(1).componentOf1.encounter(1).subject(1).patient(1).choice.patientPerson.telecom},"//s:item/@value")' property='target.{PIDgrp.PID:PhoneNumberHome(1).TelephoneNumber}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath($P(source.{controlActProcess(1).subject(1).choice.procedureRequest(1).effectiveTime},"&gt;")_"&gt;","//s:low/@value")' property='target.{ORCgrp(1).ORC:QuantityTiming(1).StartDateTime}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath($P(source.{controlActProcess(1).subject(1).choice.procedureRequest(1).effectiveTime},"&gt;",2)_"&gt;","//s:high/@value")' property='target.{ORCgrp(1).ORC:QuantityTiming(1).EndDateTime}' action='set' />
<assign value='"2.5"' property='target.{MSH:VersionID}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath(source.{controlActProcess(1).subject(1).choice.procedureRequest(1).componentOf1.encounter(1).subject(1).patient(1).choice.patientPerson.addr})' property='target.{PIDgrp.PID:PatientAddress(1)}' action='set' />
<assign value='source.{controlActProcess(1).subject(1).choice.procedureRequest(1).componentOf1.encounter(1).subject(1).patient(1).id.item(1).extension}' property='target.{PIDgrp.PID:PatientID}' action='set' />
<assign value='source.{controlActProcess(1).subject(1).choice.procedureRequest(1).componentOf1.encounter(1).subject(1).patient(1).choice.patientPerson.id.item(1).extension}' property='target.{PIDgrp.PID:PatientIdentifierList(1).IDNumber}' action='set' />
<assign value='source.{controlActProcess(1).subject(1).choice.procedureRequest(1).component2(1).choice.observationRequest(1).componentOf1.encounter(1).subject(1).patient(1).choice.patientPerson.id.item(1).root}' property='target.{PIDgrp.PID:PatientIdentifierList(1).IdentifierTypeCode}' action='set' />
<assign value='source.{controlActProcess(1).subject(1).choice.procedureRequest(1).componentOf1.encounter(1).subject(1).patient(1).choice.patientPerson.administrativeGenderCode.code}' property='target.{PIDgrp.PID:AdministrativeSex}' action='set' />
<assign value='source.{controlActProcess(1).subject(1).choice.procedureRequest(1).componentOf1.encounter(1).subject(1).patient(1).choice.patientPerson.birthTime.value}' property='target.{PIDgrp.PID:DateTimeofBirth}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath(source.{controlActProcess(1).subject(1).choice.procedureRequest(1).componentOf1.encounter(1).subject(1).patient(1).choice.patientPerson.name})' property='target.{PIDgrp.PID:PatientName(1)}' action='set' />
<assign value='source.{controlActProcess().subject().choice.procedureRequest().pertinentInformation().choice.choice.organizer()}' property='tmp' action='set' />
<assign value='##class(HCC.Utils.Functions).importXMLtoProject(tmp)' property='tmp2' action='set' />
<foreach property='tmp2' key='k1' >
<assign value='source.{controlActProcess().subject().choice.procedureRequest().pertinentInformation().choice.choice.organizer().component(k1).choice.choice.observation().code().originalText.value}' property='target.{ORCgrp().OBXgrp(k1).OBX:ObservationIdentifier.Identifier}' action='set' />
</foreach>
</transform>
}

}
